\(\int \frac {(a+b \csc (c+d \sqrt {x}))^2}{\sqrt {x}} \, dx\) [58]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 22, antiderivative size = 47 \[ \int \frac {\left (a+b \csc \left (c+d \sqrt {x}\right )\right )^2}{\sqrt {x}} \, dx=2 a^2 \sqrt {x}-\frac {4 a b \text {arctanh}\left (\cos \left (c+d \sqrt {x}\right )\right )}{d}-\frac {2 b^2 \cot \left (c+d \sqrt {x}\right )}{d} \]

[Out]

-4*a*b*arctanh(cos(c+d*x^(1/2)))/d-2*b^2*cot(c+d*x^(1/2))/d+2*a^2*x^(1/2)

Rubi [A] (verified)

Time = 0.06 (sec) , antiderivative size = 47, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.227, Rules used = {4290, 3858, 3855, 3852, 8} \[ \int \frac {\left (a+b \csc \left (c+d \sqrt {x}\right )\right )^2}{\sqrt {x}} \, dx=2 a^2 \sqrt {x}-\frac {4 a b \text {arctanh}\left (\cos \left (c+d \sqrt {x}\right )\right )}{d}-\frac {2 b^2 \cot \left (c+d \sqrt {x}\right )}{d} \]

[In]

Int[(a + b*Csc[c + d*Sqrt[x]])^2/Sqrt[x],x]

[Out]

2*a^2*Sqrt[x] - (4*a*b*ArcTanh[Cos[c + d*Sqrt[x]]])/d - (2*b^2*Cot[c + d*Sqrt[x]])/d

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3852

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Dist[-d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3858

Int[(csc[(c_.) + (d_.)*(x_)]*(b_.) + (a_))^2, x_Symbol] :> Simp[a^2*x, x] + (Dist[2*a*b, Int[Csc[c + d*x], x],
 x] + Dist[b^2, Int[Csc[c + d*x]^2, x], x]) /; FreeQ[{a, b, c, d}, x]

Rule 4290

Int[((a_.) + Csc[(c_.) + (d_.)*(x_)^(n_)]*(b_.))^(p_.)*(x_)^(m_.), x_Symbol] :> Dist[1/n, Subst[Int[x^(Simplif
y[(m + 1)/n] - 1)*(a + b*Csc[c + d*x])^p, x], x, x^n], x] /; FreeQ[{a, b, c, d, m, n, p}, x] && IGtQ[Simplify[
(m + 1)/n], 0] && IntegerQ[p]

Rubi steps \begin{align*} \text {integral}& = 2 \text {Subst}\left (\int (a+b \csc (c+d x))^2 \, dx,x,\sqrt {x}\right ) \\ & = 2 a^2 \sqrt {x}+(4 a b) \text {Subst}\left (\int \csc (c+d x) \, dx,x,\sqrt {x}\right )+\left (2 b^2\right ) \text {Subst}\left (\int \csc ^2(c+d x) \, dx,x,\sqrt {x}\right ) \\ & = 2 a^2 \sqrt {x}-\frac {4 a b \text {arctanh}\left (\cos \left (c+d \sqrt {x}\right )\right )}{d}-\frac {\left (2 b^2\right ) \text {Subst}\left (\int 1 \, dx,x,\cot \left (c+d \sqrt {x}\right )\right )}{d} \\ & = 2 a^2 \sqrt {x}-\frac {4 a b \text {arctanh}\left (\cos \left (c+d \sqrt {x}\right )\right )}{d}-\frac {2 b^2 \cot \left (c+d \sqrt {x}\right )}{d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.89 (sec) , antiderivative size = 93, normalized size of antiderivative = 1.98 \[ \int \frac {\left (a+b \csc \left (c+d \sqrt {x}\right )\right )^2}{\sqrt {x}} \, dx=\frac {-b^2 \cot \left (\frac {1}{2} \left (c+d \sqrt {x}\right )\right )+2 a \left (a c+a d \sqrt {x}-2 b \log \left (\cos \left (\frac {1}{2} \left (c+d \sqrt {x}\right )\right )\right )+2 b \log \left (\sin \left (\frac {1}{2} \left (c+d \sqrt {x}\right )\right )\right )\right )+b^2 \tan \left (\frac {1}{2} \left (c+d \sqrt {x}\right )\right )}{d} \]

[In]

Integrate[(a + b*Csc[c + d*Sqrt[x]])^2/Sqrt[x],x]

[Out]

(-(b^2*Cot[(c + d*Sqrt[x])/2]) + 2*a*(a*c + a*d*Sqrt[x] - 2*b*Log[Cos[(c + d*Sqrt[x])/2]] + 2*b*Log[Sin[(c + d
*Sqrt[x])/2]]) + b^2*Tan[(c + d*Sqrt[x])/2])/d

Maple [A] (verified)

Time = 0.72 (sec) , antiderivative size = 51, normalized size of antiderivative = 1.09

method result size
parts \(2 a^{2} \sqrt {x}-\frac {2 b^{2} \cot \left (c +d \sqrt {x}\right )}{d}-\frac {4 a b \ln \left (\csc \left (c +d \sqrt {x}\right )+\cot \left (c +d \sqrt {x}\right )\right )}{d}\) \(51\)
derivativedivides \(\frac {2 a^{2} \left (c +d \sqrt {x}\right )+4 a b \ln \left (\csc \left (c +d \sqrt {x}\right )-\cot \left (c +d \sqrt {x}\right )\right )-2 b^{2} \cot \left (c +d \sqrt {x}\right )}{d}\) \(55\)
default \(\frac {2 a^{2} \left (c +d \sqrt {x}\right )+4 a b \ln \left (\csc \left (c +d \sqrt {x}\right )-\cot \left (c +d \sqrt {x}\right )\right )-2 b^{2} \cot \left (c +d \sqrt {x}\right )}{d}\) \(55\)

[In]

int((a+b*csc(c+d*x^(1/2)))^2/x^(1/2),x,method=_RETURNVERBOSE)

[Out]

2*a^2*x^(1/2)-2*b^2*cot(c+d*x^(1/2))/d-4*a*b/d*ln(csc(c+d*x^(1/2))+cot(c+d*x^(1/2)))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 94 vs. \(2 (41) = 82\).

Time = 0.26 (sec) , antiderivative size = 94, normalized size of antiderivative = 2.00 \[ \int \frac {\left (a+b \csc \left (c+d \sqrt {x}\right )\right )^2}{\sqrt {x}} \, dx=\frac {2 \, {\left (a^{2} d \sqrt {x} \sin \left (d \sqrt {x} + c\right ) - a b \log \left (\frac {1}{2} \, \cos \left (d \sqrt {x} + c\right ) + \frac {1}{2}\right ) \sin \left (d \sqrt {x} + c\right ) + a b \log \left (-\frac {1}{2} \, \cos \left (d \sqrt {x} + c\right ) + \frac {1}{2}\right ) \sin \left (d \sqrt {x} + c\right ) - b^{2} \cos \left (d \sqrt {x} + c\right )\right )}}{d \sin \left (d \sqrt {x} + c\right )} \]

[In]

integrate((a+b*csc(c+d*x^(1/2)))^2/x^(1/2),x, algorithm="fricas")

[Out]

2*(a^2*d*sqrt(x)*sin(d*sqrt(x) + c) - a*b*log(1/2*cos(d*sqrt(x) + c) + 1/2)*sin(d*sqrt(x) + c) + a*b*log(-1/2*
cos(d*sqrt(x) + c) + 1/2)*sin(d*sqrt(x) + c) - b^2*cos(d*sqrt(x) + c))/(d*sin(d*sqrt(x) + c))

Sympy [A] (verification not implemented)

Time = 7.86 (sec) , antiderivative size = 88, normalized size of antiderivative = 1.87 \[ \int \frac {\left (a+b \csc \left (c+d \sqrt {x}\right )\right )^2}{\sqrt {x}} \, dx=\begin {cases} \frac {2 a^{2} \left (c + d \sqrt {x}\right ) - 4 a b \log {\left (\cot {\left (c + d \sqrt {x} \right )} + \csc {\left (c + d \sqrt {x} \right )} \right )} - 2 b^{2} \cot {\left (c + d \sqrt {x} \right )}}{d} & \text {for}\: d \neq 0 \\- \sqrt {x} \left (- 2 a^{2} - 4 a b \csc {\left (c \right )} - 2 b^{2} \csc ^{2}{\left (c \right )}\right ) & \text {otherwise} \end {cases} \]

[In]

integrate((a+b*csc(c+d*x**(1/2)))**2/x**(1/2),x)

[Out]

Piecewise(((2*a**2*(c + d*sqrt(x)) - 4*a*b*log(cot(c + d*sqrt(x)) + csc(c + d*sqrt(x))) - 2*b**2*cot(c + d*sqr
t(x)))/d, Ne(d, 0)), (-sqrt(x)*(-2*a**2 - 4*a*b*csc(c) - 2*b**2*csc(c)**2), True))

Maxima [A] (verification not implemented)

none

Time = 0.20 (sec) , antiderivative size = 52, normalized size of antiderivative = 1.11 \[ \int \frac {\left (a+b \csc \left (c+d \sqrt {x}\right )\right )^2}{\sqrt {x}} \, dx=2 \, a^{2} \sqrt {x} - \frac {4 \, a b \log \left (\cot \left (d \sqrt {x} + c\right ) + \csc \left (d \sqrt {x} + c\right )\right )}{d} - \frac {2 \, b^{2}}{d \tan \left (d \sqrt {x} + c\right )} \]

[In]

integrate((a+b*csc(c+d*x^(1/2)))^2/x^(1/2),x, algorithm="maxima")

[Out]

2*a^2*sqrt(x) - 4*a*b*log(cot(d*sqrt(x) + c) + csc(d*sqrt(x) + c))/d - 2*b^2/(d*tan(d*sqrt(x) + c))

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 83 vs. \(2 (41) = 82\).

Time = 0.30 (sec) , antiderivative size = 83, normalized size of antiderivative = 1.77 \[ \int \frac {\left (a+b \csc \left (c+d \sqrt {x}\right )\right )^2}{\sqrt {x}} \, dx=\frac {2 \, {\left (d \sqrt {x} + c\right )} a^{2} + 4 \, a b \log \left ({\left | \tan \left (\frac {1}{2} \, d \sqrt {x} + \frac {1}{2} \, c\right ) \right |}\right ) + b^{2} \tan \left (\frac {1}{2} \, d \sqrt {x} + \frac {1}{2} \, c\right ) - \frac {4 \, a b \tan \left (\frac {1}{2} \, d \sqrt {x} + \frac {1}{2} \, c\right ) + b^{2}}{\tan \left (\frac {1}{2} \, d \sqrt {x} + \frac {1}{2} \, c\right )}}{d} \]

[In]

integrate((a+b*csc(c+d*x^(1/2)))^2/x^(1/2),x, algorithm="giac")

[Out]

(2*(d*sqrt(x) + c)*a^2 + 4*a*b*log(abs(tan(1/2*d*sqrt(x) + 1/2*c))) + b^2*tan(1/2*d*sqrt(x) + 1/2*c) - (4*a*b*
tan(1/2*d*sqrt(x) + 1/2*c) + b^2)/tan(1/2*d*sqrt(x) + 1/2*c))/d

Mupad [B] (verification not implemented)

Time = 19.64 (sec) , antiderivative size = 111, normalized size of antiderivative = 2.36 \[ \int \frac {\left (a+b \csc \left (c+d \sqrt {x}\right )\right )^2}{\sqrt {x}} \, dx=2\,a^2\,\sqrt {x}-\frac {b^2\,4{}\mathrm {i}}{d\,\left ({\mathrm {e}}^{c\,2{}\mathrm {i}+d\,\sqrt {x}\,2{}\mathrm {i}}-1\right )}-\frac {4\,a\,b\,\ln \left (-\frac {a\,b\,4{}\mathrm {i}}{\sqrt {x}}-\frac {a\,b\,{\mathrm {e}}^{d\,\sqrt {x}\,1{}\mathrm {i}}\,{\mathrm {e}}^{c\,1{}\mathrm {i}}\,4{}\mathrm {i}}{\sqrt {x}}\right )}{d}+\frac {4\,a\,b\,\ln \left (\frac {a\,b\,4{}\mathrm {i}}{\sqrt {x}}-\frac {a\,b\,{\mathrm {e}}^{d\,\sqrt {x}\,1{}\mathrm {i}}\,{\mathrm {e}}^{c\,1{}\mathrm {i}}\,4{}\mathrm {i}}{\sqrt {x}}\right )}{d} \]

[In]

int((a + b/sin(c + d*x^(1/2)))^2/x^(1/2),x)

[Out]

2*a^2*x^(1/2) - (b^2*4i)/(d*(exp(c*2i + d*x^(1/2)*2i) - 1)) - (4*a*b*log(- (a*b*4i)/x^(1/2) - (a*b*exp(d*x^(1/
2)*1i)*exp(c*1i)*4i)/x^(1/2)))/d + (4*a*b*log((a*b*4i)/x^(1/2) - (a*b*exp(d*x^(1/2)*1i)*exp(c*1i)*4i)/x^(1/2))
)/d